package com.jiyuren.spring.api;



import com.jiyuren.spring.utils.FormatUtil;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

/**
 * @author jiyuren on 2016-11-23 16:48
 * @name com.jiyure.test.com.jiyuren.main.api.SimpleCallBack
 * @email 1126618648@qq.com
 * @descr
 * @copyright © www.jinmi.com
 */
public abstract class SimpleCallBack implements Callback {
    public void onFailure(Call call, IOException e) {
        e.printStackTrace();
        System.err.println("error" + e.getLocalizedMessage());
    }

    public void onResponse(Call call, Response response) throws IOException {
        String result = response.body().string();
        String formatResult = FormatUtil.unicode2Chinese(result);
        System.out.println(formatResult);
    }
}
